<template>
  <a-card :bordered="false">
  <a-table
    rowKey="id"
    :columns="columns"
    :expandedRowKeys="expandedRowKeys"
    :data-source="datasource"
    class="components-table-demo-nested"
    @expand="handleExpand">

    <a-table
      slot="expandedRowRender"
      slot-scope="text"
      :columns="innerColumns"
      :data-source="innerdatasource"
      :pagination="false"
    >
    </a-table>
  </a-table>
  </a-card>
</template>
<script>
  import { getAction, deleteAction, putAction, postAction, httpAction } from '@/api/manage'
  const columns = [
    { title: '课程名称', dataIndex: 'courseName', key: 'courseName' },
    { title: '课时', dataIndex: 'courseTime', key: 'courseTime' },
  ];
  const innerColumns = [
    { title: '实验序号', dataIndex: 'experimentSerialNumber', key: 'experimentSerialNumber' },
    { title: '实验名称', dataIndex: 'experimentName', key: 'experimentName' },
    { title: '实验分数',  dataIndex: 'experimentScore', key: 'experimentScore' },
  ];
  export default {
    name: 'studentCourse',
    created(){
    },
    mounted(){
      postAction("/StudentInformationcontroller/getinformation").then((res) => {
        if (res.success) {
          this.datasource=res.result.experimentByUserid;
        }
      })
    },
    data(){
      return {
        columns,
        innerColumns,
        datasource:[],
        innerdatasource:[],
        expandedRowKeys:[],
      }
    },
    methods:{
      handleExpand(expanded,record) {
        console.log("是否打开"+expanded);
        if (expanded === true) {
          this.innerdatasource=record.experimentInformation;
          this.expandedRowKeys=[];
          this.expandedRowKeys.push(record.id);
        }
        else{
          this.expandedRowKeys=[];
        }
      },
    }
  }
</script>

<style scoped>

</style>